package com.suray.wcs.service.enums;

public enum DeviceStatus {
    /**
     * 运行
     */
    RUN(1, "运行"),
    /**
     * 禁用
     */
    DISABLE(2, "禁用"),
    /**
     * 损坏
     */
    BREAKDOWN(0, "损坏");
    private int code;
    private String description;

    DeviceStatus(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public int getCode() {
        return this.code;
    }

    public static DeviceStatus parseDeviceStatusCodeCode(int deviceStatusCode) {
        DeviceStatus[] deviceStatus = DeviceStatus.values();
        for (DeviceStatus deviceStatu : deviceStatus) {
            if (deviceStatu.code == deviceStatusCode) {
                return deviceStatu;
            }
        }
        throw new IllegalArgumentException("状态参数异常");
    }

    @Override
    public String toString() {
        return description;
    }

}
